money = 5000
name = input("请输入您的姓名：")
def query():
    print("--------------查询余额--------------")
    print(f"{name}，您好，您的余额还剩：{money}")
def add(num):
    global money
    money += num
    print(f"{name}，您好，您的账户存入{num}元成功")
    print(f"{name}，您好，您的余额还剩：{money}")
def sub(num):
    global money
    if money <= num:
        print(f"{name}，您好，您的账户取出{num}元失败，账户余额不足")
        return
    money -= num
    print(f"{name}，您好，您的账户取出{num}元成功")
    print(f"{name}，您好，您的余额还剩：{money}")
def main():
    while True:
        print(f"{name}，您好，欢迎来到XXX银行，请选择操作：")
        print("查询余额\t[请输入1]")
        print("存款\t[请输入2]")
        print("取款\t[请输入3]")
        print("退出\t[请输入4]")
        oper = input("请输入您的选择：")
        if oper == "1":
            query()
        elif oper == "2":
            num = int(input("请输入存入金额："))
            add(num)
        elif oper == "3":
            num = int(input("请输入取出金额："))
            sub(num)
        elif oper == "4":
            break
main()